import { Select } from 'antd';
import { loadChannleAPI } from 'api/channel';
import React, { useEffect, useState } from 'react';
const  { Option}  =  Select
export default function Channle(props) {
// console.log(6,props);
 const [channle ,setChannles] = useState([])
  const loadChannles = async () => {
    const res = await loadChannleAPI()
    setChannles(res.data.channels)
    }

  useEffect(() => {
    loadChannles()
  },[])

    return (
        <Select style={{ width: 200 }}  placeholder='请选择频道' {...props}>
        {channle.map((item) => {
          return (
            <Option key={item.id} value={item.id}>{item.name}</Option>
          )
        })}
  </Select>

    )
}


